Hardware accelerated blend modes

ABSTRACT

Blending colors of source and destination primitives by a graphics processing unit is disclosed. The graphics processing unit executes a blending program that blends the primitives. The graphics processing unit receives the blending program from a central processing unit or a graphics application program. For example, the graphics processing unit draws a source primitive in a source texture map and a destination primitive in a destination texture map. The blending program (e.g., a pixel shader) is set to be applied to the primitives, and the graphics processing unit applies the blend mode to each pixel of the primitives, rendering a composite primitive in a destination render target.

FIELD OF THE INVENTION

The invention generally relates to the field of computer graphics andspecifically to computer hardware rendering of graphical information.

BACKGROUND OF THE INVENTION

A blend mode is a formula used in combining a color of a sourceprimitive with a color of a destination primitive to produce a new colorin a rendered primitive. A primitive is the simplest object that typicalgraphics processing units draw, and primitives may be combined to formmore robust images, shapes, backgrounds, graphics, etc. A sourceprimitive may be a primitive that is rendered atop of an existingprimitive, and a destination primitive may be the existing primitive.When using a particular blend mode to render a source primitive into adestination primitive, the blend mode may be applied to each pixel ofthe source and destination primitives. In this way, a blend mode may beapplied to each pixel of a source and of a destination primitive tocalculate a new color for each pixel of a rendered primitive.

A color of a pixel may be described by a combination of four components.Three of the components may represent the amount of red R, green G, andblue B in the color. These components may be labeled R, G, and B, eachof which may be a floating-point number ranging from 0 to 1. A fourthcomponent may be an alpha A value and may represent an opacity of apixel. An alpha A value of 0 may describe the pixel as transparent, analpha A value of 1 may describe the pixel as opaque, and a fractionalalpha A value may describe a degree of translucence of the pixel. Thefour values of R, G, B, and A thus may define a pixel's color andopacity.

Formulas for blend modes may be written in a variety of ways. Graphicsprocessing units may provide built-in support for a formula thatcomputes components of a new color N from components of a source color Sand a destination color D. The formulas may include parameters, P and Q,which may determine how a blend mode behaves. A parameter P, called a“source blend factor,” may be chosen from a set {0, 1, D_(A), 1−D_(A),D_(C), 1−D_(C)}. Similarly, a parameter Q, called a “destination blendfactor,” may be chosen from a set {0, 1, S_(A), 1−S_(A), S_(C),1−S_(C)}. Blend modes that may be built in a graphics processing unit toproduce a new color or opacity N for each pixel may include:N _(R) =P·S _(R) +Q·D _(R)N _(G) =P·S _(G) +Q·D _(G)N _(B) =P·S _(B) +Q·D _(B)N _(A) =P·S _(A) +Q·D _(A)

Blend modes may be achieved using the P and Q parameters, as listed inthe following table, Table 1: TABLE 1 Example values for parameters Pand Q Blend mode P Q Clear 0 0 Source 1 0 Destination 0 1 Source Over 11 − S_(A) Destination Over 1 − D_(A) 1 Source In D_(A) 0 Destination In0 S_(A) Source Out 1 − D_(A) 0 Destination Out 0 1 − S_(A) Source AtopD_(A) 1 − S_(A) Destination Atop 1 − D_(A) S_(A) Exclusive Or 1 − D_(A)1 − S_(A) Add 1 1 Screen 1 − D_(C) 1

Parameters in addition to P and Q may be added to blend modes to provideadditional variations for blend modes. For example, parameters X, Y, andZ may be used and may be constants with values of 0 or 1. Whencompositing an opaque source primitive with an opaque destinationprimitive, X may determine whether an intersection of the source anddestination appears in a composite primitive, Y may determine whether apart of the source primitive outside the destination primitive appears,and Z may determine whether a part of the destination primitive outsidethe source primitive appears. A function f may be a function of thesource and destination colors. The following equations may provide amore general formulation of blend modes, again computing a new color oropacity N from a given source color S and destination color D for eachpixel:N _(R) =f(S _(R) , S _(A) , D _(R) , D _(A))+Y·S _(R)·(1−D _(A))+Z·D_(R)·(1−S _(A))N _(G) =f(S _(G) , S _(A) , D _(G) , D _(A))+Y·S _(G)·(1−D _(A))+Z·D_(G)·(1−S _(A))N _(B) =f(S _(B) , S _(A) , D _(B) , D _(A))+Y·S _(B)·(1−D _(A))+Z·D_(B)·(1−S _(A))N _(A) =X·S _(A) ·D _(A) +Y·S _(A)·(1−D _(A))+Z·D _(A)·(1−S _(A))

Some blend modes may be included with, for example, drivers for agraphics processing unit, and other blend modes may be supplied by agraphics application program. Example parameter values for such blendmodes are listed in the following table, Table 2: TABLE 2 Exampleparameters for general blend formulas Blend mode f(S_(C), S_(A), D_(C),D_(A)) X Y Z Clear 0 0 0 0 Source S_(C) · D_(A) 1 1 0 Destination D_(C)· S_(A) 1 0 1 Source Over S_(C) · D_(A) 1 1 1 Destination Over D_(C) ·S_(A) 1 1 1 Source In S_(C) · D_(A) 1 0 0 Destination In D_(C) · S_(A) 10 0 Source Out 0 0 1 0 Destination Out 0 0 0 1 Source Atop S_(C) · D_(A)1 0 1 Destination Atop D_(C) · S_(A) 1 1 0 Exclusive Or 0 0 1 1 AddS_(C) · D_(A) + D_(C) · S_(A) 1 1 1 Screen S_(C) · D_(A) + D_(C) · S_(A)− S_(C) · D_(C) 1 1 1 Multiply S_(C) · D_(C) 1 1 1 Overlay 2 · S_(C) ·D_(C), if 2 · D_(C) < D_(A); 1 1 1 S_(C) · D_(C) − 2 · (D_(A) − D_(C)) ·(S_(A) − S_(C)), otherwise Lighten max(S_(C) · D_(A), D_(C) · S_(A)) 1 11 Darken min(S_(C) · D_(A), D_(C) · S_(A)) 1 1 1 Color Dodge S_(A) ·D_(A), if S_(C) · D_(A) + D_(C) · S_(A) ≧ S_(A) · D_(A); 1 1 1 D_(C) ·S_(A)/(1 − S_(C)/S_(A)), otherwise Color Burn 0, if S_(C) · D_(A) +D_(C) · S_(A) ≦ S_(A) · D_(A); 1 1 1 S_(A) · (S_(C) · D_(A) + D_(C) ·S_(A) − S_(A) · D_(A))/S_(C), otherwise Hard Light 2 · S_(C) · D_(C), if2 · S_(C) < S_(A); 1 1 1 S_(A) · D_(A) − 2 · (D_(A) − D_(C)) · (S_(A) −S_(C)), otherwise Soft Light D_(C) · (S_(A) − (1 − D_(C)/D_(A)) · (2 ·S_(C) − S_(A))), if 2 · S_(C) < S_(A); 1 1 1 D_(C) · (S_(A) − (1 −D_(C)/D_(A)) · (2 · S_(C) − S_(A)) · (3 − 8 · D_(C)/D_(A))), if 8 ·D_(C) ≦ D_(A); D_(C) · S_(A) + (D_(A) · (D_(C)/D_(A))^(0.5) − D_(C)) ·(2 · S_(C) − S_(A)), otherwise Difference abs(S_(C) · D_(A) − D_(C) ·S_(A)) 1 1 1 Exclusion S_(C) · D_(A) + D_(C) · S_(A) − 2 · S_(C) · D_(C)1 1 1

Typically, graphics processing units apply a few blend modes. For morecomplex or varied blend modes, graphics application programs may performsome or all of their rendering calculations through software on acentral processing unit. That is, the central processing unit mayperform the blending of two primitives and then send a bitmap to thegraphics processing unit for rendering. The speed of execution ofgraphics application programs therefore may be limited by the renderingspeed at which the central processing unit can render pixels of acomposite primitive. The rendering speed of a central processing unitmay be slower than the rendering speed of the graphics processing unit.

For example, a graphics application program may specify that aparticular primitive, when drawn atop other primitives, should darkenthe colors of the other primitives. The amount of darkening applied tothe existing primitives may be controlled by a luminance of the newlydrawn primitive according to a blend mode. Typically, blend modes may beapplied by the central processing unit for each pixel covered by the newprimitive in the composite rendering.

Using the central processing unit to apply a blend mode pixel by pixelmay slow application executions as the rendering process is completed.Additionally, central processing units may be pulled from completingother work to apply the blend mode, thus potentially slowing theperformance of other tasks. In a client-server scenario, the servercentral processing unit may apply the blend mode and then transmit allthe pixels of a composite primitive from the server to the client,consuming valuable bandwidth.

There is a need, therefore, for methods and apparatus for moreefficiently rendering blend modes while taking advantage of the speed ofa graphics processing unit. The methods and apparatus additionallyshould minimize the volume of calculations required of a centralprocessing unit and the bandwidth required in the rendering process.

SUMMARY OF THE INVENTION

The present invention enables graphics application program blend modesto be calculated on a graphics processing unit rather than on a centralprocessing unit. The invention may take advantage of pipelinedparallelism of current graphics hardware, free the central processingunit to perform other functions, and reduce transmission of pixels ofcomposite primitives from a server to a client. A graphics applicationprogram code calling for a blending of two or more primitives may send acentral processing unit a program that, when executed, may apply a blendmode for the blending. The central processing unit may send the programto the graphics processing unit for execution.

The graphics processing unit may execute the program, and, for example,draw a source primitive in a source texture map and draw a destinationprimitive in a destination texture map. The program for applying theblend mode to the primitives may be set to be applied to the source anddestination texture maps. The graphics processing unit may then applythe blend mode to each pixel of the primitives, and render a compositeprimitive in a destination render target.

BRIEF DESCRIPTION OF THE DRAWINGS

The foregoing summary and the following detailed description of theinvention are better understood when read in conjunction with theappended drawings. Embodiments of the invention are shown in thedrawings, however, it is understood that the invention is not limited tothe specific methods and instrumentalities depicted therein. In thedrawings:

FIG. 1 is a block diagram showing an example computing environment inwhich aspects of the invention may be implemented;

FIG. 2 is a block diagram of an example system for providing hardwareaccelerated blend modes according to the invention;

FIG. 3 is a flow diagram of an example method for providing hardwareaccelerated blend modes according to the invention; and

FIG. 4 is a flow diagram of an alternative example method for providinghardware accelerated blend modes according to the invention.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS Example ComputingEnvironment

FIG. 1 and the following discussion are intended to provide a briefgeneral description of a suitable computing environment 100 in which anexample embodiment of the invention may be implemented. As used herein,the terms “computing system,” “computer system,” and “computer” refer toany machine, system or device that comprises a processor capable ofexecuting or otherwise processing program code and/or data. Examples ofcomputing systems include, without any intended limitation, personalcomputers (PCs), minicomputers, mainframe computers, thin clients,network PCs, servers, workstations, laptop computers, hand-heldcomputers, programmable consumer electronics, multimedia consoles, gameconsoles, satellite receivers, set-top boxes, automated teller machines,arcade games, mobile telephones, personal digital assistants (PDAs) andany other processor-based system or machine. The terms “program code”and “code” refer to any set of instructions that are executed orotherwise processed by a processor. While a general purpose computer isdescribed below, this is but one example. The present invention also maybe operable on a thin client having network server interoperability andinteraction. Thus, an example embodiment of the invention may beimplemented in an environment of networked hosted services in which verylittle or minimal client resources are implicated, e.g., a networkedenvironment in which the client device serves merely as a browser orinterface to the World Wide Web.

Although not required, the invention can be implemented via anapplication programming interface (APT), for use by a developer ortester, and/or included within the network browsing software which willbe described in the general context of computer-executable instructions,such as program modules, being executed by one or more computers (e.g.,client workstations, servers, or other devices). Generally, programmodules include routines, programs, objects, components, data structuresand the like that perform particular tasks or implement particularabstract data types. Typically, the functionality of the program modulesmay be combined or distributed as desired in various embodiments. Anembodiment of the invention may also be practiced in distributedcomputing environments where tasks are performed by remote processingdevices that are linked through a communications network or other datatransmission medium. In a distributed computing environment, programmodules may be located in both local and remote computer storage mediaincluding memory storage devices.

FIG. 1 illustrates an example of a suitable computing system environment100 in which the invention may be implemented, although as made clearabove, the computing system environment 100 is only one example of asuitable computing environment and is not intended to suggest anylimitation as to the scope of use or functionality of the invention. Norshould the computing environment 100 be interpreted as having anydependency or requirement relating to any one or combination ofcomponents illustrated in the exemplary operating environment 100.

With reference to FIG. 1, an example system for implementing theinvention includes a general purpose computing device in the form of acomputer 110. Components of computer 110 may include, but are notlimited to, a central processing unit 120, a graphics processing unit125, a system memory 130, and a system bus 121 that couples varioussystem components including the system memory to the processing unit120. The system bus 121 may be any of several types of bus structuresincluding a memory bus or memory controller, a peripheral bus, and alocal bus using any of a variety of bus architectures. By way ofexample, and not limitation, such architectures include IndustryStandard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus,Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA)local bus, and Peripheral Component Interconnect (PCI) bus (also knownas Mezzanine bus). Computer 110 may additionally include an acceleratedgraphics bus through which the graphics processing unit 125 and thevideo interface 190 may communicate with the monitor 191.

The graphics processing unit 125 may render primitives and combinationsof primitives (e.g., images, shapes, backgrounds, graphics, etc.) on themonitor 191 by, for example, transforming graphic points from theprimitives to respective buffers, calculating lighting at each pixel,calculating texture on surfaces, and rendering the primitives.

Computer 110 typically includes a variety of computer readable media.Computer readable media can be any available media that can be accessedby computer 110 and includes both volatile and nonvolatile, removableand non-removable media. By way of example, and not limitation, computerreadable media may comprise computer storage media and communicationmedia. Computer storage media includes both volatile and nonvolatile,removable and non-removable media implemented in any method ortechnology for storage of information such as computer readableinstructions, data structures, program modules or other data. Computerstorage media includes, but is not limited to, random access memory(RAM), read-only memory (ROM), Electrically-Erasable ProgrammableRead-Only Memory (EEPROM), flash memory or other memory technology,compact disc read-only memory (CDROM), digital versatile disks (DVD) orother optical disk storage, magnetic cassettes, magnetic tape, magneticdisk storage or other magnetic storage devices, or any other mediumwhich can be used to store the desired information and which can beaccessed by computer 110. Communication media typically embodiescomputer readable instructions, data structures, program modules orother data in a modulated data signal such as a carrier wave or othertransport mechanism and includes any information delivery media. Theterm “modulated data signal” means a signal that has one or more of itscharacteristics set or changed in such a manner as to encode informationin the signal. By way of example, and not limitation, communicationmedia includes wired media such as a wired network or direct-wiredconnection, and wireless media such as acoustic, radio frequency (RF),infrared, and other wireless media. Combinations of any of the above arealso included within the scope of computer readable media.

The system memory 130 includes computer storage media in the form ofvolatile and/or nonvolatile memory such as ROM 131 and RAM 132. A basicinput/output system 133 (BIOS) containing the basic routines that helpto transfer information between elements within computer 110, such asduring start-up, is typically stored in ROM 131. RAM 132 typicallycontains data and/or program modules that are immediately accessible toand/or presently being operated on by processing unit 120. By way ofexample, and not limitation, FIG. 1 illustrates operating system 134,application programs 135, other program modules 136, and program data137. RAM 132 may contain other data and/or program modules.

The computer 110 may also include other removable/non-removable,volatile/nonvolatile computer storage media. By way of example only,FIG. 1 illustrates a hard disk drive 141 that reads from or writes tonon-removable, nonvolatile magnetic media, a magnetic disk drive 151that reads from or writes to a removable, nonvolatile magnetic disk 152,and an optical disk drive 155 that reads from or writes to a removable,nonvolatile optical disk 156, such as a CD ROM or other optical media.Other removable/non-removable, volatile/nonvolatile computer storagemedia that can be used in the example operating environment include, butare not limited to, magnetic tape cassettes, flash memory cards, digitalversatile disks, digital video tape, solid state RAM, solid state ROM,and the like. The hard disk drive 141 is typically connected to thesystem bus 121 through a non-removable memory interface such asinterface 140, and magnetic disk drive 151 and optical disk drive 155are typically connected to the system bus 121 by a removable memoryinterface, such as interface 150.

The drives and their associated computer storage media discussed aboveand illustrated in FIG. 1 provide storage of computer readableinstructions, data structures, program modules and other data for thecomputer 110. In FIG. 1, for example, hard disk drive 141 is illustratedas storing operating system 144, application programs 145, other programmodules 146, and program data 147. Note that these components can eitherbe the same as or different from operating system 134, applicationprograms 135, other program modules 136, and program data 137. Operatingsystem 144, application programs 145, other program modules 146, andprogram data 147 are given different numbers here to illustrate that, ata minimum, they are different copies. A user may enter commands andinformation into the computer 110 through input devices such as akeyboard 162 and pointing device 161, commonly referred to as a mouse,trackball or touch pad. Other input devices (not shown) may include amicrophone, joystick, game pad, satellite dish, scanner, or the like.These and other input devices are often connected to the processing unit120 through a user input interface 160 that is coupled to the system bus121, but may be connected by other interface and bus structures, such asa parallel port, game port or a universal serial bus (USB).

A monitor 191 or other type of display device is also connected to thesystem bus 121 via an interface, such as a video interface 190. Inaddition to monitor 191, computers may also include other peripheraloutput devices such as speakers 197 and printer 196, which may beconnected through an output peripheral interface 195.

The computer 110 may operate in a networked environment using logicalconnections to one or more remote computers, such as a remote computer180. The remote computer 180 may be a personal computer, a server, arouter, a network PC, a peer device or other common network node, andtypically includes many or all of the elements described above relativeto the computer 110, although only a memory storage device 181 has beenillustrated in FIG. 1. The logical connections depicted in FIG. 1include a local area network (LAN) 171 and a wide area network (WAN)173, but may also include other networks. Such networking environmentsare commonplace in offices, enterprise-wide computer networks, intranetsand the Internet.

When used in a LAN networking environment, the computer 110 is connectedto the LAN 171 through a network interface or adapter 170. When used ina WAN networking environment, the computer 110 typically includes amodem 172 or other means for establishing communications over the WAN173, such as the Internet. The modem 172, which may be internal orexternal, may be connected to the system bus 121 via the user inputinterface 160, or other appropriate mechanism. In a networkedenvironment, program modules depicted relative to the computer 110, orportions thereof, may be stored in the remote memory storage device. Byway of example, and not limitation, FIG. 1 illustrates remoteapplication programs 185 as residing on memory device 181. It will beappreciated that the network connections shown are exemplary and othermeans of establishing a communications link between the computers may beused.

A computer 110 or other client device can be deployed as part of acomputer network. In this regard, the present invention pertains to anycomputer system having any number of memory or storage units, and anynumber of applications and processes occurring across any number ofstorage units or volumes. An embodiment of the present invention mayapply to an environment with server computers and client computersdeployed in a network environment, having remote or local storage. Thepresent invention may also apply to a standalone computing device,having programming language functionality, interpretation and executioncapabilities.

Example Embodiments

FIG. 2 is a block diagram of an example system 200 for providinghardware accelerated blend modes according to the invention. The system200 may include a client computer 210 in communication with a servercomputer 250. It will be understood that embodiments of the inventionmay be implemented on the client computer 210 or the server computer 250alone, and that the system 200 depicts one of many exampleimplementations of the invention.

The client computer 210 and the server computer 250 each may be thecomputer 110 described with regard to FIG. 1. The client computer 210may include a central processing unit 220, a graphics applicationprogram 235, and a programmable graphics processing unit 225 and mayprovide a display to the monitor 291. The server computer 250 mayinclude a central processing unit 260 and a graphics application program265. Of course the client computer 210 and the server computer 250 mayinclude other components and may be in communication with other devices,such as those described with regard to FIG. 1.

The programmable graphics processing unit 225 may be a hardware devicethat renders primitives and combinations of primitives (e.g., images,shapes, backgrounds, graphics, etc.) on the monitor 291. Theprogrammable graphics processing unit 225 may render primitives by, forexample, transforming graphic points from the primitives to respectivebuffers, calculating lighting at each pixel, calculating texture onsurfaces, etc., and rendering the primitives on the monitor 291. Theprogrammable graphics processing unit 225 may be in communication withthe central processing unit 220 of the client computer 210.Alternatively or additionally, the programmable graphics processing unit225 may be, through the client computer 210, in communication with thecentral processing unit 260 of the server computer 250.

The graphics application programs 235, 265 each may be any applicationthat provides for rendering graphical information such as primitives.Such primitives may be anything rendered in a buffer or displayed on amonitor. Primitives may be combined and rendered as, for example,pictures, video, images, text, graphics, or shapes. The graphicsapplication programs 235, 265 may implement, through a graphicsprocessing unit, blend modes for blending a source primitive with adestination primitive. Blend modes may be implemented or applied to aprimitive through execution of a separate function, program, module, orthe like, commonly referred to as a pixel shader. As used herein, theterm pixel shader means program code that applies a blend mode. Thegraphics application programs 235, 265 may provide for the applicationof a blend mode in a pixel shader, and each pixel shader may be afunction or program for executing a blend mode.

The graphics application programs 235, 265 may communicate with or beexecuted by respective central processing units 220, 260. Duringexecution of the graphics application program 235, a source primitivemay be called to be blended with a destination primitive according to ablend mode. The graphics application program 235 may send to the centralprocessing unit 220 a pixel shader. In accordance with the presentinvention, instead of executing the pixel shader on the centralprocessing unit, the graphics application program 235 may direct thecentral processing unit 220 to send the pixel shader to the programmablegraphics processing unit 225. The central processing unit 220 may directthe programmable graphics processing unit 225 to execute the pixelshader. The pixel shader may thus facilitate applying the blend mode toeach pixel of the source and destination primitives and render acomposite primitive. That is, the programmable graphics processing unit225 may be directed to blend, according to the blend mode, the sourceand destination primitives. The programmable graphics processing unit225 may execute the pixel shader to apply the blend mode to each pixelof the source and destination primitives and to render the compositeprimitive, for example, on the monitor 291. Alternatively, the graphicsapplication program 235 may communicate with an application serving asan intermediary between the graphics application program 235 and thegraphics processing unit 225. Such an intermediary application may be agraphics processing unit driver or a graphics library comprising pixelshaders. The graphics application program 235 may direct theintermediary application to provide an appropriate pixel shader to theprogrammable graphics processing unit 225 for a blending operation. Theintermediary application may then select an appropriate pixel shader toprovide the appropriate blending and send the pixel shader to thegraphics processing unit for execution.

In an alternative embodiment, the graphics application program 265running on the server computer 250 may send a pixel shader to thecentral processing unit 260, directing the central processing unit 260to send it to the client computer 210 for execution on the programmablegraphics processing unit 225. The central processing unit 260 may directthe programmable graphics processing unit 225 to execute the pixelshader and render a composite primitive.

FIG. 3 is a flow diagram of an example method 300 for providing hardwareaccelerated blend modes according to the invention. The method maycommence at step 310 with a graphics application program (e.g., anapplication calling for a primitive to be rendered on a display) beingexecuted on a computer. The computer may be the client computer 210 orthe server computer 250 of FIG. 2, or some other computer. At step 320,the graphics application program may provide for or require a sourceprimitive to be blended with a destination primitive for rendering in abuffer (e.g., a display). The graphics application program may, at step330, send to the central processing unit a program code that, whenexecuted, applies a blend mode. Such program code may comprise a pixelshader.

At step 340, the central processing unit may send the program code to aprogrammable graphics processing unit for execution. The programmablegraphics processing unit may, at step 350, execute the program code toapply the blend mode to each pixel of the source and destinationprimitives. A composite primitive may then be rendered on a displaybuffer at step 360.

FIG. 4 is a flow diagram of an alternative example method 400 forproviding hardware accelerated blend modes according to the invention.The method may commence at step 410 with a programmable graphicsprocessing unit being directed to blend a source primitive with adestination primitive using, for example, a supplied pixel shader. Thepixel shader may be supplied by, for example, a graphics applicationprogram, a driver, a graphics library, or an operating system. At step420, the source primitive may be received and rendered to a temporarytexture map, the temporary texture map hereinafter referred to as asource texture map. The source primitive may be received from a centralprocessing unit that received it from a graphics application program.

A copy of the destination primitive from the render target may be madeand placed in a temporary texture map at step 430. This temporarytexture map is hereinafter referred to as the destination texture map.It will be understood that step 430 may be performed if the programmablegraphics processing unit used does not provide for a pixel shader toread pixel colors directly from the destination render target. If anarchitecture for a programmable graphics processing unit enables orallows reading from and writing to the same render target, step 430 maybe eliminated from the method 400.

At step 440, the pixel shader may be set to use the source anddestination texture maps during its execution. The programmable graphicsprocessing unit may execute the pixel shader at step 450, applying theblend mode to each pixel of the source and destination texture maps anddrawing a filled rectangle into the destination render target. That is,the programmable graphics processing unit may combine a source pixelcolor and a destination pixel color to produce a result color that willbe placed in the destination render target for each pixel. It will beunderstood that the pixel shader may be developed to process blend modessuch as those herein described and others using, for example, pixelshader assembly language or a higher-level shading language. If at step450, more primitives are to be rendered, then the process may repeatfrom step 420. If at step 450, no more primitives are to be rendered,then the destination render target may be displayed.

The various techniques described herein may be implemented in connectionwith hardware or software or, where appropriate, with a combination ofboth. Thus, the methods and apparatus of the present invention, orcertain aspects or portions thereof, may take the form of program code(i.e., instructions) embodied in tangible media, such as floppydiskettes, CD-ROMs, hard drives, or any other machine-readable storagemedium, wherein, when the program code is loaded into and executed by amachine, such as a computer, the machine becomes an apparatus forpracticing the invention. In the case of program code execution onprogrammable computers, the computing device will generally include aprocessor, a storage medium readable by the processor (includingvolatile and non-volatile memory and/or storage elements), at least oneinput device, and at least one output device. One or more programs arepreferably implemented in a high level procedural or object orientedprogramming language to communicate with a computer system. However, theprogram(s) can be implemented in assembly or machine language, ifdesired. In any case, the language may be a compiled or interpretedlanguage, and combined with hardware implementations.

While the present invention has been described in connection with thespecific examples in conjunction with the various figures, it is to beunderstood that other embodiments may be used or modifications andadditions may be made to the described embodiments for performing thesame function of the present invention without deviating therefrom. Theexamples are offered in explanation of the invention and are in no wayintended to limit the scope of the invention as defined in the claims.In summary, in no way is the present invention limited to the examplesprovided and described herein. Therefore, the present invention shouldnot be limited to any single embodiment, but rather should be construedin breadth and scope in accordance with the appended claims.

1. A method for performing a blend mode operation on behalf of anapplication program executing on a first processing unit, comprising:receiving first information representative of a color of a first pixel;receiving second information representative of a color of a secondpixel; receiving information representative of a formula for blendingthe color of the first pixel with the color of the second pixel; andapplying the formula to the first information and the second informationto produce third information representative of a color of a third pixel,wherein applying the formula is performed by a second processing unit.2. The method of claim 1, wherein receiving the informationrepresentative of the formula comprises receiving the informationrepresentative of the formula from the first processing unit.
 3. Themethod of claim 1, wherein receiving the information representative ofthe formula comprises receiving program code that, when executed on thesecond processing unit, causes the second processing unit to apply theformula for blending the color of the first pixel with the color of thesecond pixel.
 4. The method of claim 3, wherein the program codecomprises at least part of a pixel shader.
 5. The method of claim 3,wherein the first pixel is part of a source primitive and the secondpixel is part of a destination primitive, and wherein the method furthercomprises: receiving at the second processing unit the destinationprimitive: receiving at the second processing unit the source primitive;setting the program code to use the source and the destinationprimitives; executing the program code; and drawing the third pixel intoa destination render target.
 6. The method of claim 5, wherein thesecond processing unit: copies the destination primitive from thedestination render target to produce a copy of the destinationprimitive, and places the copy of the destination primitive in adestination texture map.
 7. The method of claim 1, wherein the firstprocessing unit is located on a computer and the second processing unitis located on the computer.
 8. The method of claim 1, wherein the firstprocessing unit is located on a first computer, and the secondprocessing unit is located on a second computer.
 9. The method of claim8, wherein the first computer is a server computer and the secondcomputer is a client of the server computer.
 10. The method of claim 1,wherein the first information comprises a set of values R, G, B, and A.11. The method of claim 1, wherein the formula is a blend mode.
 12. Amethod for performing a blend mode operation on behalf of an applicationprogram executing on a first processing unit, comprising: sending to asecond processing unit information representative of a formula forblending a color of a first pixel with a color of a second pixel tocreate a color of a third pixel; and directing the second processingunit to apply the formula to first information representative of thecolor of the first pixel and second information representative of thecolor of the second pixel to create third information representative ofthe color of the third pixel.
 13. The method of claim 12, whereinsending to the second processing unit the information representative ofthe formula comprises sending program code that, when executed on thesecond processing unit, causes the second processing unit to apply theformula for blending the color of the first pixel with the color of thesecond pixel.
 14. The method of claim 13, wherein the program codecomprises at least part of a pixel shader.
 15. The method of claim 12,wherein sending to the second processing unit the informationrepresenting the formula comprises sending the information representingthe formula from the first processing unit.
 16. The method of claim 12,wherein sending to the second processing unit the informationrepresenting the formula comprises sending the information representingthe formula from a driver associated with the second processing unit.17. The method of claim 12, wherein the first processing unit is locatedon a first computer, and the second processing unit is located on asecond computer.
 18. A computer-readable medium havingcomputer-executable instructions for performing steps, comprising:receiving first information representative of a color of a first pixel;receiving second information representative of a color of a secondpixel; receiving information representative of a formula for blendingthe color of the first pixel with the color of the second pixel; andapplying the formula to the first information and the second informationto produce third information representative of a color of a third pixel,wherein applying the formula is performed by a second processing unit onbehalf of an application program executing on a first processing unit.19. The computer-readable medium of claim 18, having furthercomputer-executable instructions for performing the steps of: receivingat the second processing unit a destination primitive: receiving at thesecond processing unit a source primitive; setting program code forapplying the formula to the first information and the second informationto use the source and destination primitives; executing the programcode; and drawing the third pixel into a destination render target. 20.The computer-readable medium of claim 19, having furthercomputer-executable instructions for performing the steps of: copyingthe destination primitive from the destination render target, producinga copy of the destination primitive; and placing the copy of thedestination primitive in the destination texture map.